package com.tq.teaching_quality.controller;


import com.tq.teaching_quality.entity.SurveyAssign;
import com.tq.teaching_quality.service.SurveyAssignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 问卷分配，即把组好的问卷，分派给哪些教学班 前端控制器
 * </p>
 *
 * @author YTH
 * @since 2020-06-29
 */
@RestController
@RequestMapping("/survey-assign")
public class SurveyAssignController {

    @Autowired
    private SurveyAssignService SurveyAssignService;

    //增加一条记录
    @RequestMapping("/AddSurveyAssign")
    public boolean AddSurveyAssign(@PathVariable("SurveyAssign") SurveyAssign SurveyAssign){
        return SurveyAssignService.save(SurveyAssign);
    }

    //删除一条记录
    @RequestMapping("/DeleteSurveyAssign")
    public boolean DeleteSurveyAssign(@PathVariable("SurveyAssignId") Long SurveyAssignId){
        return SurveyAssignService.removeById(SurveyAssignId);
    }

    //查询全部记录
    @RequestMapping("/SelectAllSurveyAssign")
    public List<SurveyAssign> SelectAllSurveyAssign(){
        return SurveyAssignService.list();
    }

    //修改一条记录
    @RequestMapping("/UpdateSurveyAssign")
    public boolean UpdateSurveyAssign(@PathVariable("SurveyAssign") SurveyAssign SurveyAssign){
        return SurveyAssignService.updateById(SurveyAssign);
    }

}

